package com.jewaton.authmanage.tools;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页参数类
 * 
 */
public class Page {

	//默认一页行数
    public static final int DEFAULT_PAGE_SIZE = 10;

    //页面行数
    private int pageSize;
    //当前页
    private int currentPage;
    //前一页
    private int prePage;
    //下一页
    private int nextPage;
    //总页数
    private int totalPage;
    //总记录数
    private int totalCount;
    //当前页查询对角集合
    @SuppressWarnings("rawtypes")
	private List list = new ArrayList();

    public Page() {
        this.currentPage = 1;
        this.pageSize = DEFAULT_PAGE_SIZE;
    }

    /**
     * 
     * @param currentPage
     * @param pageSize
     */
    public Page(int currentPage, int pageSize) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPrePage() {
    	if(currentPage==1) setPrePage(currentPage);
    	else setPrePage(currentPage-1);
        return prePage;
    }

    public void setPrePage(int prePage) {
        this.prePage = prePage;
    }

    public int getNextPage() {
    	if(currentPage==totalPage) setNextPage(currentPage);
    	else setNextPage(currentPage+1);
        return nextPage;
    }

    public void setNextPage(int nextPage) {
        this.nextPage = nextPage;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

	@SuppressWarnings("rawtypes")
	public List getList() {
		return list;
	}

	@SuppressWarnings("rawtypes")
	public void setList(List list) {
		this.list = list;
	}

}
